package controllers

import (
	"github.com/astaxie/beego"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {
	c.Data["Website"] = "beego.me"
	c.Data["Email"] = "astaxie@gmail.com"
	c.TplName = "index.tpl"
}

// 获取用户信息
func (c *MainController) UserInfo() {
	defer c.ServeJSON()
	user_id := c.GetString(":user_id")
	c.Data["json"] = map[string]interface{}{"ok": true,
		"data": map[string]interface{}{"UserId": user_id, "Info": "获取用户信息"}}
}

//用户注册
func (this *MainController) UserRegister() {
	defer this.ServeJSON()
	username := this.GetString("Username")
	password := this.GetString("Password")

	this.Data["json"] = map[string]interface{}{
		"ok": true,
		"data": map[string]interface{}{
			"data":     "恭喜你注册成功",
			"username": "用户名为:" + username,
			"password": "账号密码为:" + password}}
}
